﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace S4Store.Models.AfterSaleReport
{
    public class AfterSaleHealthyCarTypeModel : BaseReportModel
    {

        public int 应时台次 { get; set; }
        public int 实际台次 { get; set; }

        public decimal 应时产值 { get; set; }
        public decimal 实际产值 { get; set; }

        public List<Domain.AfterSaleKpi.AfterSaleCarTypeDayInput> DayDatas { get; set; }
        public List<Domain.AfterSaleKpi.AfterSaleCarTypeMonthConfig> MonthConfigs { get; set; }
        public List<Domain.AfterSaleKpi.MonthStandardConfig> StandardConfigs { get; set; }

        public List<Domain.AfterSaleKpi.AfterSaleCarTypeDayInput> DayData { get; set; }
        public List<Domain.AfterSaleKpi.AfterSaleCarTypeMonthConfig> MonthConfig { get; set; }
        public List<Domain.AfterSaleKpi.MonthStandardConfig> StandardConfig { get; set; }

        /// <summary>
        /// 目标入厂台次
        /// </summary>
        /// <param name="brandid"></param>
        /// <param name="year"></param>
        /// <param name="month"></param>
        /// <returns></returns>
        public int GetMBRCTC(int brandid , int year,int month)
        {
            var M = MonthConfigs.Where(o=>o.CarBrandId==brandid && o.Month.Year==year && o.Month.Month==month);
            if (M == null) return 0;
            return M.Sum(o => o.BYYSS5KBYS_MonthTarget5K + o.BYYSS10KBYS_MonthTarget10k + o.BYSGCRCTCMB_MonthAacidentCarToFactoryTarget + o.BYWXRCTCMB_MonthMaintainCarToFactoryTarget);
        }

        public decimal GetMBSHCZ(int brandid, int year, int month)
        {
            return 0;
        }
    }
}